package com.hlx.vo;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cglib.core.Local;


import java.sql.Time;
import java.time.LocalTime;


@Slf4j
@Data
public class TicketVo {
    private Integer trainNumberId;
    private String trainNumber;
    private Integer startId;
    private String startStation;
    private LocalTime startTime;
    private Integer arriveId;
    private String arriveStation;
    private LocalTime arriveTime;
    private LocalTime time;
    private Integer business;
    private Float businessPrice;
    private Integer first;
    private Float firstPrice;
    private Integer second;
    private Float secondPrice;


    public void setTimeFin(){
//        LocalTime arrive = this.getArriveTime().toLocalTime();
//        LocalTime start = this.getStartTime().toLocalTime();
//        System.out.println();
//        Duration duration = Duration.between(arrive,start);
//        long millis = duration.toMillis();
//        this.time = new Time(millis);
//        log.info("{},{}",this.getStartTime(),this.getArriveTime());
        Integer start = this.getStartTime().getHour() * 60 + this.getStartTime().getMinute();
        Integer end = this.getArriveTime().getHour() * 60 + this.getArriveTime().getMinute();
//        log.info("{},{}",(end-start)/60,(end-start)%60);
        this.time.of((end-start)/60,(end-start)%60,0,0);
//        System.out.println("time:"+time);
    }
}
